package com.app.web.user.info;

import com.app.base.BaseBean;
import com.app.utils.web.Param;

import java.util.Date;

/**
 * 用户信息 对应数据库的 t_user_ym
 */
public class UserInfo extends BaseBean {

	/**用户编号**/
	private long uid;
	/**自己编号，推荐码**/
	private int mcode;
	/**手机号码**/
	private long mobile;
	/**上级编号，推荐码,升级不变，用于查询**/
	private int init_pcode;
	/**上级编号，推荐码**/
	private int pcode;
	/**用户角色 0用户 1普卡 2金卡 3白金卡 4超级黑卡 5管理员**/
	private int role;
	/**角色名称 0用户 1普卡 2金卡 3白金卡 4超级黑卡 5管理员**/
	private String roleName;
	/**注册时间**/
	private Date reg_time;
	/**升级时间**/
	private Date up_time;
	/**现有子节点**/
	private String sub_node;
	/**原始子节点**/
	private String old_sub_node;

	public String getRoleName() {
		setRole(this.role);
        return roleName;
    }
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	public long getUid() {
		return uid;
	}
	public void setUid(long uid) {
		this.uid = uid;
	}
	public int getMcode() {
		return mcode;
	}
	public void setMcode(int mcode) {
		this.mcode = mcode;
	}
	public long getMobile() {
		return mobile;
	}
	public void setMobile(long mobile) {
		this.mobile = mobile;
	}
	public int getInit_pcode() {
		return init_pcode;
	}
	public void setInit_pcode(int init_pcode) {
		this.init_pcode = init_pcode;
	}
	public int getPcode() {
		return pcode;
	}
	public void setPcode(int pcode) {
		this.pcode = pcode;
	}
	public int getRole() {
		return role;
	}
	public void setRole(int role) {
		setRoleName(Param.getRoleName(role));
		this.role = role;
	}
	public Date getReg_time() {
		return reg_time;
	}
	public void setReg_time(Date reg_time) {
		this.reg_time = reg_time;
	}
	public Date getUp_time() {
		return up_time;
	}
	public void setUp_time(Date up_time) {
		this.up_time = up_time;
	}
	public String getSub_node() {
		return sub_node;
	}
	public void setSub_node(String sub_node) {
		this.sub_node = sub_node;
	}
	public String getOld_sub_node() {
		return old_sub_node;
	}
	public void setOld_sub_node(String old_sub_node) {
		this.old_sub_node = old_sub_node;
	}

	public boolean isUser() {
		return this.role == 0;
	}

	public boolean isLeader() {
		return this.role >= 1 || this.role <= 4;
	}

	public boolean isManager() {
		return this.role == 5;
	}
}
